package com.topvision.utils;

import java.io.File;

public class UpdateFileNameUtils {


    public  static void renameFile(String dir) throws Exception {

        File root = new File(dir);

        File[] fs = root.listFiles();
        for (int i = 0; i < fs.length; i++) {

            //判断文件是否存在
            if (!fs[i].exists()) {
                fs[i].createNewFile();
            }
            String rootPath = fs[i].getParent();
            String[] strings = fs[i].getName().split("\\.");
            File newFile = new File(rootPath + File.separator + strings[0] + ".jpg");
            fs[i].renameTo(newFile);


        }


    }


}